﻿<c:BaseControl x:Class="personalplaner.plugins.plananalysis.PlanAnalysisPlugin"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             xmlns:c="clr-namespace:personalplaner.common.controls;assembly=personalplaner.common"
             xmlns:conv="clr-namespace:personalplaner.common.converters;assembly=personalplaner.common"
             xmlns:bs="clr-namespace:personalplaner.business.stamm;assembly=personalplaner.business"
             xmlns:vm="clr-namespace:personalplaner.common.mvvm.factory;assembly=personalplaner.common"
             xmlns:fac="clr-namespace:personalplaner.plugins.plananalysis.viewmodels.factories"
               xmlns:k="clr-namespace:personalplaner.common.themes;assembly=personalplaner.common"
               vm:ViewModelLoader.FactoryType="{x:Type fac:PlanAnalysisPluginModelFactory}">



    <Control.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/personalplaner.common;component/resources/TabControlStyles.xaml"/>
                <!--<ResourceDictionary Source="/personalplaner.common;component/resources/styles/WhiteStyleTemplates.xaml"/>-->
                
                <ResourceDictionary>
                    <conv:ColorToSolidColorBrushConverter x:Key="colorToBrush"/>
                    
                    <DataTemplate DataType="{x:Type bs:Person}">
                        <Grid Margin="0,0,20,0" Width="150">
                            <Grid.ToolTip>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Text="{Binding Name}" Margin="0,0,5,0"/>
                                    <TextBlock Text="{Binding Nachname}" Grid.Column="2"/>
                                </Grid>
                            </Grid.ToolTip>
                            
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <Grid.OpacityMask>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                                    <GradientStop Offset="0.0" Color="Black" />
                                    <GradientStop Offset="0.8" Color="Black" />
                                    <GradientStop Offset="1.0" Color="Transparent" />
                                </LinearGradientBrush>
                            </Grid.OpacityMask>

                            <!-- Create a trasparent border that keeps the width static -->
                            <Border Background="Transparent" Width="150" Grid.ColumnSpan="2"/>
                            
                            <TextBlock Name="txtName" Text="{Binding Name}" Grid.Column="0" Margin="5,0,5,0"/>
                            <TextBlock Name="txtNachName" Text="{Binding Nachname}" Grid.Column="1"/>

                        </Grid>

                        <DataTemplate.Triggers>
                            <DataTrigger Binding="{Binding PersonTyp}" Value="Zusatzperson">
                                <Setter TargetName="txtName" Property="Foreground" Value="Green"/>
                                <Setter TargetName="txtNachName" Property="Foreground" Value="Green"/>
                            </DataTrigger>
                            <DataTrigger Binding="{Binding PersonTyp}" Value="Inaktiv">
                                <Setter TargetName="txtName" Property="Foreground" Value="Red"/>
                                <Setter TargetName="txtNachName" Property="Foreground" Value="Red"/>
                            </DataTrigger>
                        </DataTemplate.Triggers>
                    </DataTemplate>

                    
                    
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Control.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <CheckBox Margin="0,4,0,10" IsChecked="{Binding ShowAllPersonen}">
            <TextBlock Text="Alle Personen" FontWeight="Heavy" Foreground="{DynamicResource {x:Static k:ResourceKeys.ForegroundBrush}}"/><!--Foreground="#E1FFFFFF"-->
        </CheckBox>
        <ListBox Grid.Row="1" Margin="0,0,0,5" ItemsSource="{Binding Personen}" SelectedItem="{Binding SelectedPerson}" Background="#E1FFFFFF" ScrollViewer.HorizontalScrollBarVisibility="Hidden" FontWeight="Medium"/>
    </Grid>
    
</c:BaseControl>
